package study.controller;

import org.springframework.web.bind.annotation.*;
import study.entity.User;

/**
 * @RestController测试
 *
 * @author Ychiha
 * @version 1.0
 * @date 31/12/2021 下午12:57
 */
@RestController
@RequestMapping("rest")
public class RestFulController {

    /**
     * Get 查询数据
     * @return
     */
    @GetMapping("get") // url : http://localhost:8080/rest/get
    public String get(){


        return "打印字符串";
    }

    @GetMapping("user")
    public User user(){
        User u = new User(1,"yzm",22);
        return u;
    }

    /**
     * POST 新增数据
     */
    @PostMapping
    public User addUser(@RequestBody User user){

        System.out.println(user);

        return user;
    }

    //put
    //delete
}
